﻿/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * comentari cat
 * @author juli
 */

//Comentari de compta-vocals
import java.util.Scanner;

public class comptaVocals {

    public static void main(String[] args) {
        comptaVocals programa = new comptaVocals();
        programa.inici();
    }

    public void inici() {
        String text = llegir();
        int totalVocals = comptaVocals(text);
        pintar(totalVocals);
    }

    public static void pintar(int num){
        System.out.println("El total de vocals és " + num);
    }
   
    public String llegir() {
        Scanner lector = new Scanner(System.in);
        String frase = null;
        System.out.println("Escriu una frase i retorn de carro");
        frase = lector.nextLine();
        return frase;
    }

    public int comptaVocals(String paraula) {
        int comptador = 0;
        for (int i = 0; i < paraula.length(); i++) {
            int lletra = paraula.charAt(i);
            if ((lletra == 'a') || (lletra == 'e') || (lletra == 'i') || (lletra == 'o') || (lletra == 'u')) {
                comptador++;
            }
        }
        return comptador;
    }

    
}
